/******************************init****************************/
function queryParkOrgan(page) {
	var parm = $('#queryParkOgranForm').serialize() + (page != null ? ('&page=' + page) : '');
	var url = create_url('parkorgan-query');
	sys_record_parm('parkorgan',parm);
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#resultList').html(result);
		}
	});
}

function deleteParkOgran(code) {
	$.Zebra_Dialog('是否删除',{'type': 'question','title': '警告' ,
		'buttons':[
		  {caption:'删除',callback:function() {
			  var url = create_url('parkorgan-delete');
			  parkOgran_aidExecute(code, url);
			  }},
			  {caption:'取消',callback:function(){}
    	}]
	});
}
function parkOgran_aidExecute(code, url) {
	var parm = {'code':code};
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			if ('success' == result) {
				sys_msg('操作成功');
				queryParkOrgan();
			} else {
				sys_msg('操作失败');
				queryParkOrgan();
			}
		}
	});
}
/************edit******************/
function saveParkOrgan() {
	var parm = $('#editParkOgranForm').serialize();
	var url = create_url('parkorgan-save');
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
		sys_submiting_close();
			if ('success' == result) {
				sys_msg('操作成功!');
				sys_load_handle('parkorgan');
			}else if('parameter_error' == result){
				sys_msg('序号重复!');
			}
		}
	});
}
function selectOrgan() {
		var url = create_url('parkorgan-adiOrganInit');
		var parm = {};
		$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'750px',height:'500px', open:true});
}

function checkedParkOrgan(){
	var flag=true;
	var sort = $("#sort").val();
	var name = $("#name").val();
	if(name.length==0){
		sys_msg('必须选择企业');
		flag=false;
	}
	if(sort.length==0){
		sys_msg('必须填写序号');
		flag=false;
	}else if(!$.isNumeric(sort)){
		sys_msg('排行序号必须是数字');
		flag=false;
	}
	if(flag==true){
		saveParkOrgan();
	}
}
/******************************aidinit****************************/
function queryOrgan(page) {
	var parm = $('#queryParkOgranForm').serialize() + (page != null ? ('&page=' + page) : '');
	var url = create_url('parkorgan-adiOrganList');
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#resultList').html(result);
		}
	});
}
function chooseOrgan(code, name) {
	$("#oc").val(code);
	$("#name").val(name);
	$.fn.colorbox.close();
}
$(".txt_organlist_name").keydown(function(event) {
	if (event.keyCode == '13') {
		queryOrgan();
		return false;
	}
});
/******************************aidbatchinit****************************/
